package it.polimi.swimv2.remote;

import it.polimi.swimv2.exception.ModifyException;
import it.polimi.swimv2.exception.UserDataException;

import javax.ejb.Remote;

@Remote
public interface UserManagerRemote {

	/**
	 * Modifies the password of the specified user.
	 * 
	 * @param username
	 *            specifies the user
	 * @param oldPwd
	 *            the current password
	 * @param newPwd
	 *            the new password to set
	 * @return
	 * @throws ModifyException
	 *             when username and old password are not valid.
	 * @throws UserDataException
	 *             when the new password to set is not a valid password.
	 */
	public boolean modifyPassword(String username, String oldPwd, String newPwd)
			throws ModifyException, UserDataException;

	/**
	 * Modifies the data of the specified user.
	 * 
	 * @param username
	 *            specifies the user
	 * @param email
	 *            the email to set
	 * @param city
	 *            the city to set
	 * @param phone
	 *            the phone number to set
	 * @return
	 * @throws ModifyException
	 *             when the user does not exist.
	 * @throws UserDataException
	 *             when data are not valid for the application.
	 */
	public boolean modifyData(String username, String email, String city,
			String phone) throws ModifyException, UserDataException;

	/**
	 * Adds the ability to the set of declared abilities of the specified user.
	 * 
	 * @param username
	 * @param abilityName
	 * @return true if the ability has been added, false if the ability is
	 *         already declared.
	 * @throws ModifyException
	 *             when username or abilityName are not valid
	 */
	public boolean addAbility(String username, String abilityName)
			throws ModifyException;

	/**
	 * Removes the ability from the set of declared abilities of the specified
	 * user.
	 * 
	 * @param username
	 * @param abilityName
	 * @return
	 * @throws ModifyException
	 */
	public boolean removeAbility(String username, String abilityName)
			throws ModifyException;

}
